/*
 * @Author: ZhanXie
 * @Date: 2019-11-25 10:15:28
 * @LastEditors: ZhanXie
 * @LastEditTime: 2019-11-25 11:37:55
 * @Description: webpack 配置
 * @FilePath: /webpack-loader/webpack.config.js
 */
const path = require('path')

module.exports = {
  mode: 'development',
  entry: {
    main: './src/index.js'
  },
  // 作用是先从node_modules里查找模块,如果没有再从loaders里查找
  resolveLoader: {
    modules: ['node_modules', './loaders']
  },
  module: {
    rules: [
      {
        test: /\.js/,
        use: [
          {
            loader: 'replaceLoader'
          },
          {
            loader: 'replaceLoaderAsync',
            options: {
              name: 'demo'
            }
          }
        ]
      }
    ]
  },
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name].js'
  }
}